package com.zyj.myapplication.Model;

import com.zyj.myapplication.Javabean.Club;
import com.zyj.myapplication.Javabean.Train;
import com.zyj.myapplication.Javabean.TrainInfo;
import com.zyj.myapplication.Service.ClubService;
import com.zyj.myapplication.Service.TrainService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by owner on 2017/9/26.
 */

public class TrainModel {
    private Retrofit retrofit;

    public TrainModel() {
        retrofit = new Retrofit.Builder()
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://172.24.10.175/workout/api.php/")
                .build();
    }

    public retrofit2.Call<List<Train>> gettrainlist() {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTrainList();
    }

    public retrofit2.Call<List<TrainInfo>> gettrainlists() {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.gettrainList();
    }

    public Call<TrainInfo> gettrainlist(String id) {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTraininfo("lgj98rfkiqvenhrk2o7oe2po81", "train", id);
    }

    public Call<List<TrainInfo>> gettraintype(String Degree) {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getallTrain("lgj98rfkiqvenhrk2o7oe2po81", "train", Degree);
    }

    public Call<Integer> signTrain(String participantname, String train_id, String participanttel, String adultnum, String paytype,
                                   String pay, String paynotice, int userid) {
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.signTrain("signtrain", participantname, train_id, participanttel, adultnum, paytype, pay, paynotice, userid, "lgj98rfkiqvenhrk2o7oe2po81");
    }
}
